<template>
    <view class="uu-project-item-card">
        <view class="avatar">
            <image mode="aspectFit" :src="cardData?.avatar" />
        </view>
        <view class="right">
            <view class="top">
                <view class="project-name">{{ cardData?.projectName }}</view>
                <view class="project-money">￥{{ cardData?.money }}</view>
            </view>
            <view class="bottom">
                <view class="project-time">{{ cardData?.time }}分钟</view>
                <view class="project-count">
                    <number-count-input :value='cardData?.count'
                        @change="(e: any) => (handleChange(e))"></number-count-input>

                </view>
            </view>
        </view>
    </view>
</template>

<script setup lang="ts">
import { ref, computed, onMounted } from "vue";
import { onShow, onHide } from "@dcloudio/uni-app";
const emits = defineEmits(['projectCountChange'])
interface ProjectCardType {
    id: string | number;
    avatar: string;
    projectName: string;
    money: string | number;
    time: string | number;
    count: string | number

}
const props = withDefaults(defineProps<{
    cardData: ProjectCardType
}>(), {
    cardData: () => ({
        id: 1,
        avatar: '',
        projectName: '台球助教',
        money: 58.80,
        time: 165,
        count: 3,
    }),
})
const handleChange = (e: any) => {
    emits("projectCountChange", e)
}
</script>

<style lang="less" scoped>
.uu-project-item-card {
    width: 688rpx;
    height: 198rpx;
    box-sizing: border-box;
    padding: 30rpx;
    background: #FFFFFF;
    border-radius: 15rpx 15rpx 15rpx 15rpx;
    display: flex;


    .avatar {
        width: 137rpx;
        height: 137rpx;
        margin-right: 30rpx;
        border-radius: 15rpx 15rpx 15rpx 15rpx;
        overflow: hidden;
        // background-color: rgb(228, 121, 20);
        object-fit: contain;

        image {
            width: 137rpx;
            height: 137rpx;
            display: block;
            // background-size: contain;
        }
    }

    .right {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 61rpx;

        .top {
            display: flex;
            justify-content: space-between;
            align-items: center;

            .project-name {
                height: 38rpx;
                line-height: 38rpx;
                font-weight: 500;
                font-size: 27rpx;
                color: #333333;
                text-align: left;

            }

            .project-money {
                height: 38rpx;
                line-height: 38rpx;
                font-weight: 600;
                font-size: 27rpx;
                color: #FE4857;
                text-align: right;

            }
        }

        .bottom {
            display: flex;
            justify-content: space-between;
            align-items: center;

            .project-time {
                height: 29rpx;
                line-height: 29rpx;
                font-weight: 500;
                font-size: 21rpx;
                color: #777777;
                text-align: left;
            }

            .project-count {
                width: 154rpx;
                height: 47rpx;
                background: red;
                border-radius: 63rpx 63rpx 63rpx 63rpx;
            }
        }


    }
}
</style>
